<?php
//*****************|							|******************
//*****************|  METHODS WEBSERVICE CMAPS  |******************
//*****************|							|******************

	function callGetResourceRootMeta($objClient,$accountList)
	{
		$params['account-list'] = $accountList;

		try{
			$objRes = $objClient->__soapCall("getRootResourceMeta", array($params)); //
		}
		catch(SoapFault $fault) {
			return $fault;
		}
		
		//print_r($objRes);
		$arrRootResourceMetaList=(array)$objRes;
		$arrResMeta=(array)$arrRootResourceMetaList['res-meta'];
		//print_r($arrResMeta);
		return $arrResMeta;
	}

	function callGetResourceRootMetaList($objClient,$accountList)
	{
		$params['account-list'] = $accountList;

		try{
			$objRes = $objClient->__soapCall("getRootResourceMetaList", array($params)); //
		}
		catch(SoapFault $fault) {
			print_r("ERRO em callGetResourceRootMetaList");
		}		
		//print_r($objRes);
		$arrRootResourceMetaList=(array)$objRes;
		$arrResMetaList=(array)$arrRootResourceMetaList['res-meta-list'];
		$arrResMeta=(array)$arrResMetaList['res-meta'];
		//print_r($arrResMeta);
		return $arrResMeta;
	}

	function callGetResourceMeta($objClient,$accountList,$resourceURL)
	{
		$params['resource-url'] = $resourceURL;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("getResourceMeta",array($params));//
		}
		catch (SoapFault $fault) {
			return $fault;
		}

		$arrResourceMetaList=(array)$objRes;
		$arrResMeta=(array)$arrResourceMetaList['res-meta'];
		//print_r($arrResMeta);
		return $arrResMeta;
	}

	function callGetResourceMetaList($objClient,$accountList,$folderURL)
	{
		$params['folder-url'] = $folderURL;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("getResourceMetaList",array($params));//print_r($objRes); //
		}
		catch (SoapFault $fault) {
			print_r("ERRO em callGetResourceMetaList");
		}
		//print_r($objRes);
		$arrResourceMetaList=(array)$objRes;
		$arrResMetaList=(array)$arrResourceMetaList['res-meta-list'];
		$arrResMeta=(array)$arrResMetaList['res-meta'];

		return $arrResMeta;
	}

	function callGetResource($objClient,$accountList,$resourceURL)
	{
		$params['resource-url'] = $resourceURL;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("getResource",array($params)); //
		}
		catch (SoapFault $fault) {
			print_r("ERRO em callGetResource");
		}
		
		//print_r($objRes);
		return $objRes;
	}

	
	function callCreateResource($objClient,$accountList,$resMeta,$folderUrl,$resource)
	{
		$params['res-meta'] = $resMeta;
		$params['folder-url'] = $folderUrl;
		$params['resource'] = $resource;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("createResource",array($params)); //
		}
		catch (SoapFault $fault) {
			print_r($fault);
		}

		//print_r($objRes);
		
		return $objRes;
	}

	function callSaveResource($objClient,$accountList,$resourceURL,$resource)
	{
		$params['resource-url'] = $resourceURL;
		$params['resource'] = $resource;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("saveResource",array($params)); //
		}
		catch (SoapFault $fault) {
			print_r("ERRO em saveResource"."\n");
			print_r($fault);
		}

		//print_r($objRes);
		
		return $objRes;
	}

	function callSetResourceMeta($objClient,$accountList,$resourceMeta)
	{
		print_r($accountList);
		$params['res-meta'] = '';
		//$params['resource'] = $resource;
		$params['account-list'] = $accountList;

		try {$objRes = $objClient->__soapCall("setResourceMeta",array($params)); //
		}
		catch (SoapFault $fault) {
			print_r("ERRO em setResourceMeta");
			print_r($fault);
			print($fault->__toString());
		}

		//print_r($objRes);
		
		return $objRes;
	}


	function callGetCmap($objClient,$accountList,$resourceURL)
	{
		$params['resource-url'] = $resourceURL;
		$params['account-list'] = $accountList;
		
		//print_r($resourceURL);print_r('-----');
		//print_r($objClient);print_r($accountList);print_r($resourceURL);print_r('+++++');

		try {$objRes = $objClient->__soapCall("getCmap",array($params)); //
		}
		catch (SoapFault $fault) {
			return $fault;
		}
		//print_r($objRes);print_r('*****');

		return $objRes;
	}

	

	function callSaveCmap($objClient,$accountList,$resourceURL,$cmap)
	{
		$params['resource-url'] = $resourceURL;
		$params['cmap'] = $cmap;
		$params['account-list'] = $accountList;

		//print_r($objClient);print_r($accountList);print_r($resourceURL);print_r($cmap);
		//print_r($objClient);print_r($accountList);print_r($resourceURL);

		try {$objRes = $objClient->__soapCall("saveCmap",array($params)); //
		}
		catch (SoapFault $fault) {
			return $fault;
		}

		//print_r($objRes);

		return $objRes;
	}

	function callDeleteCmap($objClient,$accountList,$resourceURL)
	{
		$params['resource-url'] = $resourceURL;
		$params['account-list'] = $accountList;

		//print_r($objClient);print_r($accountList);print_r($resourceURL);print_r($cmap);
		//print_r($objClient);print_r($accountList);print_r($resourceURL);

		try {$objRes = $objClient->__soapCall("delete",array($params)); //
		}
		catch (SoapFault $fault) {
			return $fault;
		}

		//print_r($objRes);

		return $objRes;
	}
